/*****************************************************************************
 * plum_print.h
 *
 * Copyright (C) 2020 Jeasonvor 1101627719@qq.com
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 ****************************************************************************/
#ifndef __PLUM_PRINT_H__
#define __PLUM_PRINT_H__

/*****************************************************************************
 * Included Files
 ****************************************************************************/
#include <stdarg.h>
/*****************************************************************************
 * Pre-processor Definitions
 ****************************************************************************/

#define PRINTF_NTOA_BUFFER_SIZE        32U
#define PRINTF_FTOA_BUFFER_SIZE        32U
#define PRINTF_DEFAULT_FLOAT_PRECISION 6U
#define PRINTF_MAX_FLOAT               1e9
#define PRINTF_SUPPORT_FLOAT
#define PRINTF_SUPPORT_EXPONENTIAL
#define PRINTF_SUPPORT_LONG_LONG
#define PRINTF_SUPPORT_PTRDIFF_T

#define plum_printk printf  // plum_printf

/*****************************************************************************
 * Public Types
 ****************************************************************************/

typedef int (*kernel_putchar_t)(PLUM_CONST plum_s8 ch);

/*****************************************************************************
 * Public Data
 ****************************************************************************/

/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
 * Public Function Prototypes
 ****************************************************************************/

/**
 * @brief:  向内核注册数据发送函数
 *
 * @param[in]:  func    -   数据定位函数
 *
 * @return: 返回错误码
 */
plum_s32 plum_kernel_register_putchar(kernel_putchar_t func);

plum_s32 plum_printf(PLUM_CONST plum_s8* format, ...);

plum_s32 plum_sprintf(plum_s8* buffer, PLUM_CONST plum_s8* format, ...);

plum_s32 plum_snprintf(plum_s8* buffer, size_t count,
                       PLUM_CONST plum_s8* format, ...);

plum_s32 plum_vsnprintf(plum_s8* buffer, size_t count,
                        PLUM_CONST plum_s8* format, va_list va);

plum_s32 plum_vprintf(PLUM_CONST plum_s8* format, va_list va);

/****************************************************************************/
#ifdef __cplusplus
}
#endif
/****************************************************************************/
#endif /* __PLUM_PRINT_H__ */
/****************************************************************************/
/*                                                                          */
/*  End of file.                                                            */
/*                                                                          */
/****************************************************************************/
